EMT Practice Test

1. Question Content...


Question List

Question1: Provider dependencies are created in several different ways. Select the valid provider dependencies from the following list: (select three)

Question2: You have recently started a new job at a retailer as an engineer. As part of this new role, you have been tasked with evaluating multiple outages that occurred during peak shopping time during the holiday season. Your investigation found that the team is manually deploying new compute instances and configuring each compute instance manually. This has led to inconsistent configuration between each compute instance.
How would you solve this using infrastructure as code?

Question3: A variable az has the following default value. What will be the datatype of the variable?
az=["us-west-1a","us-east-1a"]

Question4: Given the below resource configuration -
resource "aws_instance" "web" { # ... count = 4 }
What does the terraform resource address aws_instance.web refer to?

Question5: Which of the following is the correct way to pass the value in the variable num_servers into a module with the input servers?

Question6: Which of the following challenges would Terraform be a candidate for solving? (Select THREE)

Question7: By default, provisioners that fail will also cause the Terraform apply itself to error. How can you change this default behavior within a provisioner?

Question8: State is a requirement for Terraform to function

Question9: During a terraform apply, a resource is successfully created but eventually fails during provisioning. What happens to the resource?

Question10: When does terraform apply reflect changes in the cloud environment?

Question11: What does terrafom plan do ?

Question12: In terraform, most resource dependencies are handled automatically. Which of the following statements describes best how terraform resource dependencies are handled?

Question13: Terraform has detailed logs which can be enabled by setting the _________ environmental variable.

Question14: Which of the following Terraform commands will automatically refresh the state unless supplied with additional flags or arguments? Choose TWO correct answers.

Question15: Which of the below features of Terraform can be used for managing small differences between different environments which can act more like completely separate working directories.

Question16: The following is a snippet from a Terraform configuration file:
Which, when validated, results in the following error:
Fill in the blank in the error message with the correct string from the list below.

Question17: Only the user that generated a plan may apply it.

Question18: You run a local-exec provisioner in a null resource called null_resource.run_script and realize that you need to rerun the script.
Which of the following commands would you use first?

Question19: Which of the following is available only in Terraform Enterprise or Cloud workspaces and not in Terraform CLI?

Question20: Select the operating systems which are supported for a clustered Terraform Enterprise: (select four)

Question21: Valarie has created a database instance in AWS and for ease of use is outputting the value of the database password with the following code. Valarie wants to hide the output value in the CLI after terraform apply that's why she has used sensitive parameter.
1. output "db_password" {
2. value = local.db_password
3. sensitive = true
4. }
Since sensitive is set to true, will the value associated with db password be available in plain-text in the state file for everyone to read?

Question22: You want to get involved in the development of Terraform. As this is an open source project, you would like to contribute a fix for an open issue of Terraform. What programming language will need to use to write the fix?

Question23: You have configured an Auto Scaling group in AWS to automatically scale the number of instances behind a load balancer based on the instances CPU utilization. The instances are configured using a Launch Configuration. You have observed that the Auto Scaling group doesn't successfully scale when you apply changes that require replacing the Launch Configuration. Why is this happening?

Question24: Select the feature below that best completes the sentence:
The following list represents the different types of __________ available in Terraform.
1. max
2. min
3. join
4. replace
5. list
6. length
7. range

Question25: Your company has been using Terraform Cloud for a some time now . But every team is creating their own modules , and there is no standardization of the modules , with each team creating the resources in their own unique way . You want to enforce a standardization of the modules across the enterprise . What should be your approach.

Question26: Terraform providers are always installed from the Internet.

Question27: A user has created three workspaces using the command line - prod, dev, and test. The user wants to create a fourth workspace named stage. Which command will the user execute to accomplish this?

Question28: Which feature of Terraform allows multiple state files for a single configuration file depending upon the environment?

Question29: Which task does terraform init not perform?

Question30: True or False? Each Terraform workspace uses its own state file to manage the infrastructure associated with that particular workspace.

Question31: If you enable TF_LOG = DEBUG, the log will be stored in syslog.log file in the currect directory.

Question32: The terraform.tfstate file always matches your currently built infrastructure.

Question33: When writing Terraform code, HashiCorp recommends that you use how many spaces between each nesting level?

Question34: Once a resource is marked as tainted, the next plan will show that the resource will be _________ and
___________ and the next apply will implement this change.

Question35: What Terraform feature is shown in the example below?

Question36: What is a downside to using the Vault provider to read secrets from Vault?

Question37: The Terraform language does not support user-defined functions, and so only the functions built in to the language are available for use.

Question38: When should you use the force-unlock command?

Question39: What does the command terraform fmt do?

Question40: Why might a user opt to include the following snippet in their configuration file?

Question41: Which of the following is considered a Terraform plugin?

Question42: Which of the following Terraform files should be ignored by Git when committing code to a repo? (select Three)

Question43: What is the standard workflow that a developer follows while working with terraform open source version?

Question44: What does terraform refresh command do?

Question45: What kind of resource dependency is stored in terraform.tfstate file?

Question46: Which of the following is not a valid string function in Terraform?

Question47: During a terraform plan, a resource is successfully created but eventually fails during provisioning. What happens to the resource?

Question48: ABC Enterprise has recently tied up with multiple small organizations for exchanging database information.
Due to this, the firewall rules are increasing and are more than 100 rules. This is leading firewall configuration file that is difficult to manage. What is the way this type of configuration can be managed easily?

Question49: A user creates three workspaces from the command line - prod, dev, and test. Which of the following commands will the user run to switch to the dev workspace?

Question50: Refer to the following terraform variable definition
variable "track_tag" { type = list default = ["data_ec2","integration_ec2","digital_ec2"]} track_tag = { Name = element(var.track_tag,count.index)} If count.index is set to 2, which of the following values will be assigned to the name attribute of track_tag variable?

Question51: Ric wants to enable detail logging and he wants highest verbosity of logs. Which of the following environment variable settings is correct option for him to select.

Question52: Terraform variables and outputs that set the "description" argument will store that description in the state file.

Question53: What command should you run to display all workspaces for the current configuration?

Question54: In Terraform Enterprise, a workspace can be mapped to how many VCS repos?

Question55: What information does the public Terraform Module Registry automatically expose about published modules?

Question56: Where in your Terraform configuration do you specify a state backend?

Question57: Complete the following sentence:
For local state, the workspaces are stored directly in a ___________.

Question58: Terraform Enterprise (also referred to as pTFE) requires what type of backend database for a clustered deployment?

Question59: A single terraform resource file that defines an aws_instance resource can simply be renamed to vsphere_virtual_machine in order to switch cloud providers.

Question60: Which of the following best describes the default local backend?

Question61: When configuring a remote backend in Terraform, it might be a good idea to purposely omit some of the required arguments to ensure secrets and other important data aren't inadvertently shared with others. What are the ways the remaining configuration can be added to Terraform so it can initialize and communicate with the backend? (select three)

Question62: What is the provider for this fictitious resource?

Question63: Which of the following variable definition files will terraform load automatically?

Question64: What are some of the problems of how infrastructure was traditionally managed before Infrastructure as Code?
(select three)

Question65: A "backend" in Terraform determines how state is loaded and how an operation such as apply is executed.
Which of the following is not a supported backend type?

Question66: What is not processed when running a terraform refresh?

Question67: Your manager has instructed you to start using terraform for the entire infra provisioning of the application stack. There are 4 environments - DEV , QA , UAT , and PROD. The application team has asked for complete segregation between these environments including the backend , state , and also configurations ,since there will be unique resources in different environments . What is the possible way to structure the terraform code to facilitate that.

Question68: Terraform works well in Windows but a Windows server is required.

Question69: Consider the following Terraform 0.12 configuration snippet:
1. variable "vpc_cidrs" {
2. type = map
3. default = {
4. us-east-1 = "10.0.0.0/16"
5. us-east-2 = "10.1.0.0/16"
6. us-west-1 = "10.2.0.0/16"
7. us-west-2 = "10.3.0.0/16"
8. }
9. }
10.
11. resource "aws_vpc" "shared" {
12. cidr_block = _____________
13. }
How would you define the cidr_block for us-east-1 in the aws_vpc resource using a variable?

Question70: You have created a custom variable definition file testing.tfvars. How will you use it for provisioning infrastructure?

Question71: While Terraform is generally written using the HashiCorp Configuration Language (HCL), what other syntax can Terraform are expressed in?

Question72: Which of the below configuration file formats are supported by Terraform? (Select TWO)

Question73: By default, where does Terraform store its state file?

Question74: What is the workflow for deploying new infrastructure with Terraform?

Question75: Your team lead does not trust the junior terraform engineers who now have access to the git repo . So , he wants you to have some sort of a checking layer , whereby , you can ensure that the juniors will not create any non-compliant resources that might lead to a security audit failure in future. What can you do to efficiently enforce this?

Question76: Which of the following represents a feature of Terraform Cloud that is NOT free to customers?

Question77: terraform state subcommands such as list are read-only commands, do read-only commands create state backup files?

Question78: You have created two workspaces PROD and DEV. You have switched to DEV and provisioned DEV infrastructure from this workspace. Where is your state file stored?

Question79: You have created an AWS EC2 instance of type t2.micro through your terraform configuration file ec2.tf .
Now you want to change the instance type from t2.micro to t2.medium. Accordingly you have changed your configuration file and and ran terraform plan. After running terraform plan you check the output and saw one instance will be updated from t2.micro --> t2.medium. After this you went to grab a coffee without running terraform apply and meanwhile a member of your team changed the instance type of that EC2 instance to t2.medium from aws console. After coming to your desk you run terraform apply. What will happen?

Question80: True or False? By default, Terraform destroy will prompt for confirmation before proceeding.

Question81: Where does the Terraform local backend store its state?

Question82: Which two steps are required to provision new infrastructure in the Terraform workflow? (Choose two.)

Question83: What is the default backend for Terraform?

Question84: Your organization has moved to AWS and has manually deployed infrastructure using the console. Recently, a decision has been made to standardize on Terraform for all deployments moving forward.
What can you do to ensure that all existing is managed by Terraform moving forward without interruption to existing services?

Question85: After running into issues with Terraform, you need to enable verbose logging to assist with troubleshooting the error. Which of the following values provides the MOST verbose logging?

Question86: Select all features which are exclusive to Terraform Enterprise. (Select Three)

Question87: Select two answers to complete the following sentence: Before a new provider can be used, it must be ______ and _______.

Question88: Which of the following are string functions? Select three

Question89: Which of the following statements best describes the Terraform list(...) type?

Question90: lookup retrieves the value of a single element from which of the below data type?

Question91: In the example below, where is the value of the DNS record's IP address originating from?
1. resource "aws_route53_record" "www"
2. {
3. zone_id = aws_route53_zone.primary.zone_id
4. name = "www.example.com"
5. type = "A"
6. ttl = "300"
7. records = [module.web_server.instance_ip_address]
8. }

Question92: You have declared a variable called var.list which is a list of objects that all have an attribute id.
Which options will produce a list of the IDs? (Choose two.)

Question93: Matt wants to import a manually created EC2 instance into terraform so that he can manage the EC2 instance through terraform going forward. He has written the configuration file of the EC2 instance before importing it to Terraform. Following is the code:
resource "aws_instance" "matt_ec2" { ami = "ami-bg2640de" instance_type = "t2.micro" vpc_security_group_ids = ["sg-6ae7d613", "sg-53370035"] key_name = "mysecret" subnet_id =
"subnet-9e3cfbc5" }
The instance id of that EC2 instance is i-0260835eb7e9bd40 How he can import data of EC2 to state file?

Question94: When Terraform needs to be installed in a location where it does not have internet access to download the installer and upgrades, the installation is generally known as to be __________.

Question95: Command terraform refresh will update state file?

Question96: Your team has started using terraform OSS in a big way , and now wants to deploy multi region deployments (DR) in aws using the same terraform files . You want to deploy the same infra (VPC,EC2 ...) in both us-east-1 ,and us-west-2 using the same script , and then peer the VPCs across both the regions to enable DR traffic. But , when you run your script , all resources are getting created in only the default provider region.
What should you do? Your provider setting is as below -
# The default provider configuration provider "aws" { region = "us-east-1" }

Question97: Talal is a DevOps engineer and he has deployed the production infrastructure using Terraform. He is using a very large configuration file to maintain and update the actual infrastructure. As the infrastructure have grown to a very complex and large, he has started experiencing slowness when he run runs terraform plan. What are the options for him to resolve this slowness?